package salary

type ChangeClassificationTransaction struct {
	ChangeEmployeeTransaction
	GetPaymentClassification func() PaymentClassification
	GetPaymentSchedule       func() PaymentSchedule
}

func (c *ChangeClassificationTransaction) Change(employee Employee) {
	employee.PaymentClassification = c.GetPaymentClassification()
	employee.PaymentSchedule = c.GetPaymentSchedule()
}

type ChangeCommissionedTransaction struct {
	ChangeEmployeeTransaction
	MonthlySalary  float64
	CommissionRate float64
}

func GetChangeCommissionedTransaction(employeeId int, monthlySalary float64, commissionRate float64) *ChangeCommissionedTransaction {
	c := &ChangeCommissionedTransaction{
		*GetChangeEmployeeTransaction(employeeId),
		monthlySalary,
		commissionRate,
	}
	c.ChangeEmployeeTransaction.Change = c.Change
	return c
}

func (c *ChangeCommissionedTransaction) GetPaymentClassification() PaymentClassification {
	return &CommissionedClassification{MonthlySalary: c.MonthlySalary, CommissionRate: c.CommissionRate}
}
func (c *ChangeCommissionedTransaction) GetPaymentSchedule() PaymentSchedule {
	return &BiWeeklySchedule{}
}

type ChangeHourlyTransaction struct {
	ChangeEmployeeTransaction
	HourlyRate float64
}

func GetChangeHourlyTransaction(employeeId int, hourlyRate float64) *ChangeHourlyTransaction {
	c := &ChangeHourlyTransaction{
		*GetChangeEmployeeTransaction(employeeId),
		hourlyRate,
	}
	c.ChangeEmployeeTransaction.Change = c.Change
	return c
}

func (c *ChangeHourlyTransaction) GetPaymentClassification() PaymentClassification {
	return &HourlyClassification{HourlyRate: c.HourlyRate}
}
func (c *ChangeHourlyTransaction) GetPaymentSchedule() PaymentSchedule {
	return &WeeklySchedule{}
}

// ChangeSalariedTransaction
type ChangeSalariedTransaction struct {
	ChangeEmployeeTransaction
	MonthlySalary float64
}

func GetChangeSalariedTransaction(employeeId int, monthlySalary float64) *ChangeSalariedTransaction {
	c := &ChangeSalariedTransaction{
		*GetChangeEmployeeTransaction(employeeId),
		monthlySalary,
	}
	c.ChangeEmployeeTransaction.Change = c.Change
	return c
}

func (c *ChangeSalariedTransaction) GetPaymentClassification() PaymentClassification {
	return &SalariedClassification{MonthlySalary: c.MonthlySalary}
}
func (c *ChangeSalariedTransaction) GetPaymentSchedule() PaymentSchedule {
	return &MonthlySchedule{}
}
